This tutorial uses R version 4.0.0, RRPP version 0.5.2, tidyverse version 1.3.0, and kableExtra version 1.1.0.

  1. load necessary packages
library(RRPP)
library(tidyverse)
library(kableExtra)
  1. Upload data
path <- "~/Box/Summer 2018 TX Endo Field Samples and Analysis/Statistics/Old + Young Chlorophyll/"

chldata <- read.csv(paste(path, "chlorophyll_data.csv", sep = ""), 
    header = T, row.names = 1)

# create a total chlorophyll column (a + b)
chldata$Total <- chldata$Chl.a + chldata$Chl.b
  1. Calculate total chlorophyll content, summary statistics, and visualize data.
# plot chl a
chla <- chldata %>% ggplot(aes(x = Fungus, y = Chl.a, fill = Water)) + 
    geom_boxplot() + theme_classic() + facet_wrap(~Age, dir = "v")
print(chla + labs(title = "Chlorophyll a Content in Leaves"))

# plot chl b
chlb <- chldata %>% ggplot(aes(x = Fungus, y = Chl.b, fill = Water)) + 
    geom_boxplot() + theme_classic() + facet_wrap(~Age, dir = "v")
print(chlb + labs(title = "Chlorophyll b Content in Leaves"))

# plot total chlorophyll
tot <- chldata %>% ggplot(aes(x = Fungus, y = Total, fill = Water)) + 
    geom_boxplot() + theme_classic() + facet_wrap(~Age, dir = "v")
print(tot + labs(title = "Total Chlorophyll Content in Leaves"))

# plot chl b/a ratio
chlb.a <- chldata %>% ggplot(aes(x = Fungus, y = Chl.b.a.ratio, 
    fill = Water)) + geom_boxplot() + theme_classic() + facet_wrap(~Age, 
    dir = "v")
print(chlb.a + labs(title = "Chlorophyll b/a Ratio"))

# summary statistics
stats <- chldata %>% group_by(Water, Fungus) %>% select(Chl.a) %>% 
    summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, 
        Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))

stats2 <- chldata %>% group_by(Water, Fungus) %>% select(Chl.b) %>% 
    summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, 
        Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))

stats3 <- chldata %>% group_by(Water, Fungus) %>% select(Chl.b.a.ratio) %>% 
    summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, 
        Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))

stats4 <- chldata %>% group_by(Water, Fungus) %>% select(Total) %>% 
    summarise_each(funs(Min = min, Q1 = quantile(., 0.25), Median = median, 
        Q3 = quantile(., 0.75), Max = max, Mean = mean, SD = sd))


stats %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(` ` = 2, 
    `Chl a` = 7)) %>% collapse_rows()
Chl a
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 1.3785 1.438375 1.64465 1.845525 2.4325 1.730400 0.3969141
Cer 2.4034 2.659700 2.91600 3.172300 3.4286 2.916000 0.7249259
Cok 4.2542 4.348175 4.44215 4.536125 4.6301 4.442150 0.2658014
Ctrl 0.6543 2.416075 2.74235 2.996475 4.1046 2.605350 1.1327896
Nig 1.3885 1.886175 2.97785 3.276550 4.0201 2.710450 1.0410501
Pen 1.4103 1.623000 1.99855 2.549825 3.0217 2.110083 0.6443822
Pod 2.2508 2.407100 3.64395 4.842250 4.8829 3.605400 1.4465113
Pre 2.5646 2.589350 2.64125 2.792350 3.1147 2.740450 0.2546096
Xyl 1.9925 2.196050 2.26565 2.330000 2.5178 2.260400 0.2145433
Low Asp 1.8032 2.282550 3.41230 3.680150 4.1644 3.077933 0.9724927
Cer 1.3056 1.858450 2.19620 2.475375 2.9348 2.157850 0.5733045
Cok 2.3816 2.930825 3.58330 4.209275 4.6790 3.556800 1.0136576
Ctrl 1.3706 2.521075 2.91315 3.413525 5.2171 3.064117 1.2833496
Nig 1.3661 1.783475 2.35900 3.125225 4.1147 2.549700 1.1977419
Pen 0.7559 1.814325 2.37305 3.791275 4.6496 2.673950 1.4901283
Pod 1.1815 1.904725 2.13075 3.335300 6.8223 2.971917 2.0599131
Pre 0.8341 0.970475 1.15580 3.003875 4.4658 2.023350 1.5892062
Xyl 1.4374 2.124750 2.81210 3.499450 4.1868 2.812100 1.9441194
stats2 %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(` ` = 2, 
    `Chl b` = 7)) %>% collapse_rows()
Chl b
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 1.1578 1.802800 2.06590 2.651275 3.4807 2.221967 0.8188023
Cer 2.3279 2.979350 3.63080 4.282250 4.9337 3.630800 1.8425789
Cok 4.1675 4.628375 5.08925 5.550125 6.0110 5.089250 1.3035514
Ctrl 0.7493 2.652775 3.44605 4.228750 5.8297 3.391517 1.7540252
Nig 1.4517 1.897100 3.63340 4.264575 5.5941 3.350983 1.6580124
Pen 1.1784 2.192475 2.23820 2.712925 4.2843 2.497917 1.0301252
Pod 1.8431 2.224775 4.54235 6.762600 6.8523 4.445025 2.7190193
Pre 2.3051 2.662850 3.23910 3.894375 4.4892 3.318125 0.9708800
Xyl 1.9172 1.994675 2.64285 3.366050 3.6686 2.717875 0.8814486
Low Asp 2.1927 3.570600 5.40600 7.116375 9.3309 5.496817 2.6947445
Cer 1.1950 2.996500 3.61605 4.056800 5.5423 3.493850 1.4477185
Cok 2.6757 3.764025 4.33190 4.794500 5.5670 4.226625 1.1983699
Ctrl 1.4843 1.872325 3.38255 4.510275 5.0331 3.256267 1.5551574
Nig 2.2579 4.842175 5.99005 6.284650 6.3091 5.136775 1.9392895
Pen 0.9236 2.263875 2.80870 3.530525 6.3876 3.130333 1.8490598
Pod -0.1698 0.237575 1.50615 4.320025 5.2567 2.195317 2.4760652
Pre 0.8355 1.220800 1.75545 2.810150 6.3290 2.479950 2.0534522
Xyl 5.7141 5.869250 6.02440 6.179550 6.3347 6.024400 0.4388305
stats3 %>% kable() %>% kable_styling(full_width = F) %>% add_header_above(c(` ` = 2, 
    `Chl b/a` = 7)) %>% collapse_rows()
Chl b/a
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 0.8399000 1.0947000 1.345747 1.473605 1.513249 1.261981 0.2721681
Cer 0.9686000 1.0861968 1.203794 1.321390 1.438987 1.203794 0.3326139
Cok 0.9001000 1.0283148 1.156530 1.284744 1.412959 1.156530 0.3626463
Ctrl 1.0730000 1.1162250 1.277402 1.411244 1.420294 1.261076 0.1690156
Nig 0.8948000 0.9843500 1.245312 1.409754 1.446971 1.199054 0.2498186
Pen 0.8204000 0.8932000 1.242076 1.456214 1.484446 1.182250 0.3142204
Pod 0.8189000 0.9220250 1.175364 1.396577 1.403323 1.143238 0.3004410
Pre 0.8585000 1.0282250 1.253842 1.427493 1.441321 1.201876 0.2815388
Xyl 0.8925000 0.9447750 1.201136 1.444321 1.457067 1.187960 0.3023483
Low Asp 0.8165000 1.2490922 1.397398 2.129357 4.745607 1.988317 1.4430095
Cer 0.9153000 1.2432041 1.441539 1.852052 2.742500 1.617810 0.6550962
Cok 0.8820000 1.0631250 1.248568 1.394481 1.457018 1.209038 0.2600366
Ctrl 0.5008402 0.9324500 1.133150 1.357552 1.460632 1.087613 0.3580767
Nig 1.1744000 1.3332090 1.821573 2.841354 4.594418 2.352991 1.5660008
Pen 0.8517000 0.9573000 1.297849 1.408012 1.489756 1.204278 0.2805299
Pod -0.0844468 0.1964067 1.026300 1.360309 2.335800 0.949229 0.9190565
Pre 0.8746000 0.9963500 1.335999 1.474218 1.545791 1.249302 0.2936034
Xyl 1.3647763 2.1253072 2.885838 3.646369 4.406900 2.885838 2.1511063
stats4 %>% kable() %>% kable_styling(full_width = F, ) %>% add_header_above(c(` ` = 2, 
    `Total Chlorophyll` = 7)) %>% collapse_rows()
Total Chlorophyll
Water Fungus Min Q1 Median Q3 Max Mean SD
High Asp 2.5363 3.311200 3.71055 4.426775 5.9132 3.952367 1.184572
Cer 4.7313 5.639050 6.54680 7.454550 8.3623 6.546800 2.567505
Cok 8.7976 9.164500 9.53140 9.898300 10.2652 9.531400 1.037750
Ctrl 1.4036 5.068850 6.18840 7.225225 9.9343 5.996867 2.870463
Nig 2.9146 3.833050 6.78635 7.260450 9.6142 6.061433 2.640505
Pen 2.5887 3.875550 4.52275 4.916675 7.3060 4.608000 1.573892
Pod 4.0939 4.631875 8.18630 11.604850 11.7352 8.050425 4.165380
Pre 4.9900 5.257525 5.82020 6.621250 7.6039 6.058575 1.167894
Xyl 3.9097 4.190725 4.90850 5.696050 6.1864 4.978275 1.063039
Low Asp 3.9959 7.250750 9.28470 10.581175 11.2971 8.574750 2.771967
Cer 2.5006 5.226200 5.77320 6.885400 7.5632 5.651700 1.806590
Cok 5.0573 7.002500 8.22835 9.009275 9.6197 7.783425 1.988842
Ctrl 3.0058 4.583650 6.01750 8.208475 9.8370 6.320383 2.620370
Nig 4.1805 6.777075 8.37355 9.282950 9.8183 7.686475 2.506609
Pen 1.6795 4.293075 5.07940 7.209275 11.0372 5.804283 3.241293
Pod 1.8412 2.814625 5.06620 7.297150 8.9249 5.167233 2.912251
Pre 1.7535 2.128350 2.91125 5.814025 10.7948 4.503300 3.583994
Xyl 7.7721 8.304300 8.83650 9.368700 9.9009 8.836500 1.505289
  1. Run Linear models in RRPP for each fungal treatment and estimate model coefficients. “d” is the amount of change in a variable for the coefficient indicated.
high <- chldata %>% filter(Water == "High") %>% droplevels.data.frame()
low <- chldata %>% filter(Water == "Low") %>% droplevels.data.frame()

# chl b/a ratio linear models and coefficient tests
highLM <- lm.rrpp(Chl.b.a.ratio ~ Block * Fungus * Age, data = high, 
    SS.type = "III", print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(highLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 2.392622  0.01395011 0.9942033 44.26136
##                      Z (from F)       Pr(>F)
## Block * Fungus * Age   7.315093 0.0005714286
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##                Trace Proportion Rank
## Fitted    0.06134928  0.9942034    1
## Residuals 0.00035770  0.0057968    1
## Total     0.06170697  1.0000000    1
## 
## Eigenvalues
## 
##                  PC1
## Fitted    0.06134928
## Residuals 0.00035770
## Total     0.06170697
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                d.obs  UCL (95%)         Zd Pr(>d)
## (Intercept)               0.62593333 0.78962415 -1.7018084  0.952
## Block                     0.21035000 0.20532837  1.7769127  0.032
## FungusCer                 0.13231667 0.16036021  0.9805991  0.174
## FungusCok                 0.06381667 0.09639785  0.8228150  0.198
## FungusCtrl                0.44870000 0.40717963  2.2324016  0.015
## FungusNig                 0.14976667 0.20793797  0.7808900  0.230
## FungusPen                 0.03556667 0.15704248 -0.5937618  0.657
## FungusPod                 0.46796667 0.34985738  2.9073139  0.001
## FungusPre                 0.11941667 0.16757535  0.9150558  0.196
## FungusXyl                 0.19686667 0.22600022  1.3330707  0.104
## AgeYoung                  0.76904060 0.71435667  2.4423778  0.011
## Block:FungusCtrl          0.19355000 0.17343434  2.3367838  0.009
## Block:FungusNig           0.10820000 0.13335851  0.8374439  0.210
## Block:FungusPen           0.08740000 0.10245408  1.1892266  0.135
## Block:FungusPod           0.34785000 0.27436479  3.0336971  0.001
## Block:FungusPre           0.09720000 0.11787687  1.0388508  0.154
## Block:FungusXyl           0.14065000 0.16774755  1.1616270  0.142
## Block:AgeYoung            0.16917263 0.13960447  2.6008443  0.005
## FungusCer:AgeYoung        0.12948086 0.14525467  1.4486806  0.100
## FungusCok:AgeYoung        0.08700861 0.11893465  1.0380282  0.157
## FungusCtrl:AgeYoung       0.41916536 0.27876256  3.5208619  0.002
## FungusNig:AgeYoung        0.09549141 0.18202537  0.3279167  0.329
## FungusPen:AgeYoung        0.02459043 0.27774227 -1.2738062  0.905
## FungusPod:AgeYoung        0.47760590 0.25875163  4.7649109  0.001
## FungusPre:AgeYoung        0.10072544 0.20149123  0.3180400  0.311
## FungusXyl:AgeYoung        0.16876311 0.26671137  0.7328366  0.215
## Block:FungusCtrl:AgeYoung 0.14707756 0.08482203  4.1435533  0.001
## Block:FungusNig:AgeYoung  0.05145228 0.08667462  0.6014386  0.252
## Block:FungusPen:AgeYoung  0.07179740 0.08862127  1.3539332  0.112
## Block:FungusPod:AgeYoung  0.31566678 0.14336820  5.8587068  0.001
## Block:FungusPre:AgeYoung  0.06524132 0.08701065  1.0789188  0.146
## Block:FungusXyl:AgeYoung  0.11646746 0.14606068  1.2626616  0.130
lowLM <- lm.rrpp(Chl.b.a.ratio ~ Block * Fungus * Age, data = low, 
    SS.type = "III", print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(lowLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 38.48417    4.291964 0.8996645 3.260568
##                      Z (from F)     Pr(>F)
## Block * Fungus * Age   1.697163 0.04057143
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    0.8552037  0.8996645    1
## Residuals 0.0953770  0.1003355    1
## Total     0.9505807  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    0.8552037
## Residuals 0.0953770
## Total     0.9505807
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                 d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               2.604166667  2.380548  2.19819037  0.033
## Block                     0.570500000  0.911889  0.67613518  0.244
## FungusCer                 0.569933333  3.572471 -1.21800447  0.869
## FungusCok                 1.963666667  2.973625  0.84748777  0.192
## FungusCtrl                1.861066667  2.960517  0.61208920  0.275
## FungusNig                 0.194133333  2.542255 -1.05724107  0.877
## FungusPen                 1.976066667  2.375479  1.30245979  0.119
## FungusPod                 0.004266667  4.284208 -2.20896620  1.000
## FungusPre                 1.971166667  2.385919  1.37534386  0.115
## FungusXyl                 2.373233333  4.428246 -1.11996396  0.863
## AgeYoung                  3.487937297  2.290608  3.53650583  0.003
## Block:FungusCer           0.210000000  1.701526 -1.30906211  0.906
## Block:FungusCok           0.812000000  1.863189  0.07669004  0.406
## Block:FungusCtrl          0.724250000  1.615380 -0.12155632  0.525
## Block:FungusNig           0.029200000  1.169686 -1.23012054  0.951
## Block:FungusPen           0.746900000  1.387197  0.37657861  0.330
## Block:FungusPod           0.001950000  2.094904 -2.37351080  1.000
## Block:FungusPre           0.760600000  1.330731  0.47355806  0.298
## Block:AgeYoung            2.269119123  1.510589  3.55997849  0.001
## FungusCer:AgeYoung        1.380191764  3.848950 -0.17714962  0.489
## FungusCok:AgeYoung        4.137690011  3.997899  1.94003885  0.045
## FungusCtrl:AgeYoung       4.781024939  3.642115  2.88065883  0.005
## FungusNig:AgeYoung        0.471646461  3.513066 -0.85062696  0.768
## FungusPen:AgeYoung        4.241875805  3.355649  2.81425797  0.010
## FungusPod:AgeYoung        2.760631578  4.764139  0.33808800  0.364
## FungusPre:AgeYoung        4.264315316  3.303189  2.93256167  0.009
## FungusXyl:AgeYoung        1.823305527  5.201613 -1.57956277  0.947
## Block:FungusCer:AgeYoung  1.210536461  1.478774  1.27216653  0.120
## Block:FungusCok:AgeYoung  2.427236353  2.385815  1.99211764  0.046
## Block:FungusCtrl:AgeYoung 2.878650458  1.481022  5.00004366  0.001
## Block:FungusNig:AgeYoung  0.123682936  1.594242 -1.01668608  0.859
## Block:FungusPen:AgeYoung  2.422709974  1.459703  4.11219575  0.002
## Block:FungusPod:AgeYoung  2.419037276  1.447938  4.03337324  0.002
## Block:FungusPre:AgeYoung  2.421205917  1.458626  4.03168898  0.001
  1. Run ANOVA in RRPP for each linear model.
# chl b/a ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(highANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS       MS      Rsq       F        Z Pr(>F)   
## Block             1 0.08849 0.088494 0.036772 50.7490           0.003 **
## Fungus            8 0.07465 0.009331 0.031019  0.8201 -0.43603  0.656   
## Age               1 0.12673 0.126734 0.052661 29.0071           0.037 * 
## Block:Fungus      6 0.06827 0.011378 0.028368  6.5250  1.82704  0.022 * 
## Block:Age         1 0.02862 0.028619 0.011892  6.5505           0.046 * 
## Fungus:Age        8 0.03616 0.004520 0.015025  1.0345 -0.42431  0.651   
## Block:Fungus:Age  6 0.02621 0.004369 0.010893  2.5055  1.19833  0.106   
## Residuals         8 0.01395 0.001744 0.005797                           
## Total            39 2.40657                                             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b.a.ratio ~ Block * Fungus * Age, SS.type = "III",  
##     data = high, print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(lowANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS     MS      Rsq      F        Z Pr(>F)  
## Block             1  0.651 0.6509 0.015217 1.8200           0.183  
## Fungus            8 10.522 1.3153 0.245979 3.9387  0.91855  0.188  
## Age               1  2.607 2.6069 0.060944 2.1006  1.15093  0.087 .
## Block:Fungus      7  2.338 0.3339 0.054645 0.9336 -0.00297  0.501  
## Block:Age         1  5.149 5.1489 0.120369 4.1489           0.040 *
## Fungus:Age        8  9.881 1.2351 0.230997 0.9953 -0.19437  0.587  
## Block:Fungus:Age  7  8.687 1.2410 0.203084 3.4698  1.84012  0.023 *
## Residuals        12  4.292 0.3577 0.100336                         
## Total            45 42.776                                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b.a.ratio ~ Block * Fungus * Age, SS.type = "III",  
##     data = low, print.progress = F)
  1. Test pairwise differences between least squares means. Similar to tukeyHSD function in the r stats package. The pairwise function will generate tables with confidence intervals and p‐values for the pairwise statistic, Euclidean distance between least‐squares means.
# chl b/a ratio pairwise
highpw <- pairwise(highLM, groups = high$Fungus)
summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d  UCL (95%)             Z Pr > d
## Asp:Cer  0.058187450 0.10362515 -0.0346201754  0.509
## Asp:Cok  0.105451323 0.14966563  0.0190512654  0.493
## Asp:Ctrl 0.000905116 0.03796745 -1.2585487742  0.968
## Asp:Nig  0.062926762 0.09451527  0.0231018162  0.502
## Asp:Pen  0.079731152 0.10889033 -0.0410287190  0.529
## Asp:Pod  0.118743037 0.15222646 -0.0085941455  0.504
## Asp:Pre  0.060104737 0.09521596 -0.0286808290  0.519
## Asp:Xyl  0.074021132 0.10748402 -0.0087205741  0.506
## Cer:Cok  0.047263873 0.10049838 -0.0224210471  0.479
## Cer:Ctrl 0.057282334 0.10313445 -0.0114821100  0.502
## Cer:Nig  0.004739313 0.05099240 -1.0911271960  0.879
## Cer:Pen  0.021543703 0.06519094 -0.3260920691  0.566
## Cer:Pod  0.060555587 0.10432917  0.0136784160  0.472
## Cer:Pre  0.001917287 0.05199894 -1.2895651944  0.947
## Cer:Xyl  0.015833683 0.06386772 -0.5432613083  0.642
## Cok:Ctrl 0.104546207 0.14853223  0.0408905511  0.481
## Cok:Nig  0.042524561 0.08436076 -0.0262240862  0.471
## Cok:Pen  0.025720171 0.06928486 -0.1973884123  0.479
## Cok:Pod  0.013291714 0.06068414 -0.6399579370  0.674
## Cok:Pre  0.045346586 0.08764837 -0.0090404191  0.490
## Cok:Xyl  0.031430191 0.07696863 -0.1177374124  0.498
## Ctrl:Nig 0.062021646 0.09150534  0.0559327036  0.482
## Ctrl:Pen 0.078826036 0.10975971 -0.0076700792  0.492
## Ctrl:Pod 0.117837921 0.15166548  0.0198723805  0.491
## Ctrl:Pre 0.059199621 0.09263527  0.0006638177  0.502
## Ctrl:Xyl 0.073116016 0.10843133  0.0196979463  0.482
## Nig:Pen  0.016804390 0.04702013 -0.2927374501  0.553
## Nig:Pod  0.055816275 0.08712838 -0.0311029320  0.514
## Nig:Pre  0.002822025 0.04009023 -1.1086653292  0.896
## Nig:Xyl  0.011094370 0.04675439 -0.5807182213  0.670
## Pen:Pod  0.039011885 0.07138210  0.0136824892  0.491
## Pen:Pre  0.019626415 0.05276055 -0.2556348307  0.544
## Pen:Xyl  0.005710020 0.04093107 -0.8670715107  0.794
## Pod:Pre  0.058638300 0.09537530  0.0146895642  0.500
## Pod:Xyl  0.044721905 0.08076102 -0.0175396702  0.504
## Pre:Xyl  0.013916396 0.04935847 -0.4613067814  0.597
highpw2 <- pairwise(highLM, groups = high$Age)
summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)          Z Pr > d
## Old:Young 0.4570754 0.4738713 0.01935818  0.493
lowpw <- pairwise(lowLM, groups = low$Fungus)
summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d UCL (95%)            Z Pr > d
## Asp:Cer  0.370507246 0.8824098 -0.146156889  0.513
## Asp:Cok  0.779278707 1.3245751 -0.021183465  0.517
## Asp:Ctrl 0.900704655 1.4303293 -0.006761711  0.516
## Asp:Nig  0.364673628 0.9346442 -0.174334354  0.512
## Asp:Pen  0.784038739 1.2714713 -0.002437905  0.492
## Asp:Pod  1.039088154 1.5285736  0.032213714  0.502
## Asp:Pre  0.739014926 1.2570003 -0.006926196  0.500
## Asp:Xyl  0.897521008 1.6447366 -0.020139560  0.496
## Cer:Cok  0.408771461 1.0035870 -0.162227989  0.505
## Cer:Ctrl 0.530197409 1.0699132 -0.053384542  0.493
## Cer:Nig  0.735180874 1.3234989 -0.011188988  0.489
## Cer:Pen  0.413531493 0.9215101 -0.110791419  0.514
## Cer:Pod  0.668580908 1.1774047  0.012461459  0.483
## Cer:Pre  0.368507680 0.8670062 -0.159698713  0.520
## Cer:Xyl  1.268028254 2.0177650 -0.008447710  0.495
## Cok:Ctrl 0.121425948 0.6870629 -0.815420164  0.758
## Cok:Nig  1.143952335 1.7519492 -0.013823141  0.507
## Cok:Pen  0.004760032 0.6707432 -1.266044505  0.984
## Cok:Pod  0.259809447 0.8187707 -0.325649671  0.557
## Cok:Pre  0.040263781 0.7021350 -1.087281063  0.893
## Cok:Xyl  1.676799715 2.4871440 -0.020665013  0.487
## Ctrl:Nig 1.265378283 1.7925585 -0.008130811  0.504
## Ctrl:Pen 0.116665916 0.6867539 -0.724696498  0.713
## Ctrl:Pod 0.138383499 0.6365635 -0.663442545  0.688
## Ctrl:Pre 0.161689729 0.6769211 -0.555791625  0.637
## Ctrl:Xyl 1.798225663 2.5619190 -0.016507705  0.491
## Nig:Pen  1.148712367 1.7013890 -0.002288398  0.488
## Nig:Pod  1.403761782 1.9756911  0.026647003  0.487
## Nig:Pre  1.103688554 1.6786208 -0.005586874  0.501
## Nig:Xyl  0.532847380 1.3596688 -0.157290367  0.498
## Pen:Pod  0.255049415 0.7325595 -0.277786545  0.555
## Pen:Pre  0.045023813 0.6088501 -1.064300159  0.879
## Pen:Xyl  1.681559747 2.4587113 -0.012092696  0.498
## Pod:Pre  0.300073228 0.8107839 -0.160157623  0.494
## Pod:Xyl  1.936609162 2.7075396  0.009614820  0.490
## Pre:Xyl  1.636535934 2.3869078 -0.015338941  0.491
lowpw2 <- pairwise(lowLM, groups = low$Age)
summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)          Z Pr > d
## Old:Young 0.1482125 0.4289912 -0.2611132  0.542
  1. Examine RRPP plots to check for assumptions.
## chl b/a ratio residuals vs fitted values (homoscedasticity
## check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, 
    high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, 
    low$Fungus))

  1. Repeat steps 4 - 7 for chlorophyll a and b
## chl a linear models and coefficient tests
highLM <- lm.rrpp(Chl.a ~ Block * Fungus * Age, data = high, 
    SS.type = "III", print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(highLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 34.62868    4.896895 0.8761082 1.824918
##                      Z (from F)    Pr(>F)
## Block * Fungus * Age  0.9115409 0.1735714
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    0.8879149  0.8761082    1
## Residuals 0.1255614  0.1238918    1
## Total     1.0134763  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    0.8879149
## Residuals 0.1255614
## Total     1.0134763
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               1.4887000 3.0853911 -0.91657749  0.849
## Block                     0.0189000 0.7339735 -1.36102805  0.978
## FungusCer                 0.8958000 1.5052538  0.45423624  0.298
## FungusCok                 3.1225000 3.7312653  0.50712316  0.295
## FungusCtrl                0.4613333 1.9695736 -0.55591572  0.648
## FungusNig                 2.5825333 2.5229932  1.84283976  0.039
## FungusPen                 1.2428667 2.3952412  0.24622508  0.364
## FungusPod                 1.1789000 2.3172255  0.29964699  0.316
## FungusPre                 1.2563500 1.8762403  0.82941234  0.195
## FungusXyl                 1.0466000 2.2303053  0.21596324  0.338
## AgeYoung                  1.3735000 1.7854776  1.21858669  0.121
## Block:FungusCtrl          0.0708500 0.8329686 -1.00025230  0.856
## Block:FungusNig           1.0067000 0.9537625  2.06332649  0.037
## Block:FungusPen           0.3558500 0.9118538 -0.03534143  0.443
## Block:FungusPod           0.2273000 1.3362326 -0.77682599  0.747
## Block:FungusPre           0.0790500 0.9938551 -1.13348777  0.890
## Block:FungusXyl           0.2903000 1.4039738 -0.62786431  0.674
## Block:AgeYoung            0.4828500 0.8200662  0.63112918  0.231
## FungusCer:AgeYoung        0.1345500 1.9780155 -1.16347793  0.900
## FungusCok:AgeYoung        1.2665500 1.9560037  0.67878754  0.239
## FungusCtrl:AgeYoung       1.1549333 3.1216804 -0.25203936  0.546
## FungusNig:AgeYoung        2.1915667 2.9151877  1.07410148  0.158
## FungusPen:AgeYoung        0.8735667 2.3490271 -0.16738373  0.489
## FungusPod:AgeYoung        0.7334000 4.7852567 -1.13050431  0.862
## FungusPre:AgeYoung        1.7795000 2.4210114  1.10464050  0.147
## FungusXyl:AgeYoung        1.8918000 3.1764876  0.64418769  0.230
## Block:FungusCtrl:AgeYoung 0.0221500 1.0969676 -1.30517232  0.967
## Block:FungusNig:AgeYoung  1.5067000 1.1356602  3.00484209  0.013
## Block:FungusPen:AgeYoung  0.2853000 1.0946470 -0.49818084  0.625
## Block:FungusPod:AgeYoung  0.7454500 1.7882282  0.02809061  0.410
## Block:FungusPre:AgeYoung  0.8015500 1.0987716  1.02549553  0.167
## Block:FungusXyl:AgeYoung  1.0046500 1.8675746  0.44887360  0.288
lowLM <- lm.rrpp(Chl.a ~ Block * Fungus * Age, data = low, SS.type = "III", 
    print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(lowLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 67.19567    13.12627 0.8365793 1.861519
##                      Z (from F)    Pr(>F)
## Block * Fungus * Age   1.115489 0.1235714
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    1.4932372  0.8365793    1
## Residuals 0.2916948  0.1634207    1
## Total     1.7849320  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    1.4932372
## Residuals 0.2916948
## Total     1.7849320
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               4.3430667  6.609287 -0.62588375  0.749
## Block                     0.7142000  1.810957 -0.73988334  0.756
## FungusCer                 2.7943333  4.862370  0.23929076  0.400
## FungusCok                 2.6333333  4.084301  0.70598992  0.216
## FungusCtrl                2.5017333  3.048351  1.27451234  0.120
## FungusNig                 1.1112667  3.089896 -0.14606177  0.471
## FungusPen                 1.6043667  3.427425  0.20001063  0.366
## FungusPod                 1.5069667  6.422746 -1.72609263  0.956
## FungusPre                 0.2210000  2.806793 -1.03369918  0.862
## FungusXyl                 2.1914667  3.982275 -0.34410244  0.639
## AgeYoung                  1.0963333  2.885914 -0.05362694  0.424
## Block:FungusCer           0.8895000  1.872724  0.12187111  0.424
## Block:FungusCok           1.5832000  2.518236  0.74871140  0.213
## Block:FungusCtrl          1.2090500  1.446024  1.41494296  0.098
## Block:FungusNig           0.2778000  1.349741 -0.59721995  0.673
## Block:FungusPen           1.0023500  1.785917  0.40209781  0.309
## Block:FungusPod           0.1797000  2.580560 -1.94442949  0.978
## Block:FungusPre           0.6740500  1.693491 -0.14023799  0.498
## Block:AgeYoung            0.3849000  1.425723 -0.42277444  0.577
## FungusCer:AgeYoung        0.9018000  4.007211 -0.59667920  0.667
## FungusCok:AgeYoung        3.0812333  5.174928  0.64969711  0.233
## FungusCtrl:AgeYoung       4.2113000  4.220907  1.92897216  0.052
## FungusNig:AgeYoung        1.1608667  4.044206 -0.39651985  0.576
## FungusPen:AgeYoung        1.2637000  4.089974 -0.31428285  0.542
## FungusPod:AgeYoung        2.8811000  5.491102  0.26335630  0.365
## FungusPre:AgeYoung        0.1191667  3.962217 -1.21226643  0.950
## FungusXyl:AgeYoung        2.0379667  5.011630 -0.57240819  0.702
## Block:FungusCer:AgeYoung  0.3556500  1.906550 -0.71204832  0.721
## Block:FungusCok:AgeYoung  1.7435000  2.968737  0.58480712  0.249
## Block:FungusCtrl:AgeYoung 2.0082000  1.968025  2.03272731  0.043
## Block:FungusNig:AgeYoung  0.5530000  1.870426 -0.34142341  0.567
## Block:FungusPen:AgeYoung  0.6282000  1.904982 -0.22795535  0.504
## Block:FungusPod:AgeYoung  2.4821000  2.013197  2.80958917  0.013
## Block:FungusPre:AgeYoung  0.1321000  1.821151 -1.10340450  0.894
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(highANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)
## Block             1  0.001 0.00071 0.000018 0.0012           0.832
## Fungus            8  6.835 0.85442 0.172936 3.6871  0.87411  0.202
## Age               1  0.404 0.40425 0.010228 1.3942           0.204
## Block:Fungus      6  1.390 0.23174 0.035178 0.3786 -0.97017  0.849
## Block:Age         1  0.233 0.23314 0.005899 0.8041           0.326
## Fungus:Age        8  2.416 0.30205 0.061134 1.0417 -0.22250  0.555
## Block:Fungus:Age  6  1.740 0.28994 0.044013 0.4737 -0.82589  0.804
## Residuals         8  4.897 0.61211 0.123892                       
## Total            39 39.526                                        
## 
## Call: lm.rrpp(f1 = Chl.a ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(lowANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F         Z Pr(>F)
## Block             1  1.020 1.02016 0.012701 0.9326            0.277
## Fungus            8 14.156 1.76956 0.176246 1.5751  0.281274  0.360
## Age               1  0.258 0.25756 0.003207 0.2084  0.099191  0.542
## Block:Fungus      7  7.864 1.12346 0.097909 1.0271  0.174149  0.430
## Block:Age         1  0.148 0.14815 0.001844 0.1199            0.625
## Fungus:Age        8  8.488 1.06096 0.105671 0.8586 -0.280167  0.612
## Block:Fungus:Age  7  8.649 1.23563 0.107684 1.1296  0.259904  0.404
## Residuals        12 13.126 1.09386 0.163421                        
## Total            45 80.322                                         
## 
## Call: lm.rrpp(f1 = Chl.a ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus)
summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)             Z Pr > d
## Asp:Cer  1.1856000 1.6802680  6.023151e-02  0.499
## Asp:Cok  2.7117500 3.2327485 -9.985210e-03  0.520
## Asp:Ctrl 0.8749500 1.2504739 -2.410592e-05  0.494
## Asp:Nig  0.9800500 1.3563340 -1.935596e-02  0.510
## Asp:Pen  0.3796833 0.7976021 -3.101756e-02  0.490
## Asp:Pod  1.8750000 2.2877578  7.267837e-04  0.503
## Asp:Pre  1.0100500 1.4345776 -4.036789e-03  0.500
## Asp:Xyl  0.5300000 0.9277738  3.401526e-02  0.483
## Cer:Cok  1.5261500 2.2614225 -5.739252e-02  0.521
## Cer:Ctrl 0.3106500 0.8291124 -2.545953e-01  0.540
## Cer:Nig  0.2055500 0.7366934 -4.863965e-01  0.618
## Cer:Pen  0.8059167 1.3489886  4.596325e-02  0.493
## Cer:Pod  0.6894000 1.3019102 -7.582346e-02  0.518
## Cer:Pre  0.1755500 0.7570581 -6.165458e-01  0.669
## Cer:Xyl  0.6556000 1.2029159 -1.354628e-02  0.498
## Cok:Ctrl 1.8368000 2.3409031 -9.725432e-03  0.514
## Cok:Nig  1.7317000 2.2866762  3.812979e-03  0.507
## Cok:Pen  2.3320667 2.8531326 -1.451847e-02  0.513
## Cok:Pod  0.8367500 1.4065309 -2.298182e-02  0.512
## Cok:Pre  1.7017000 2.2537116 -5.963106e-03  0.505
## Cok:Xyl  2.1817500 2.7507572 -4.619412e-02  0.529
## Ctrl:Nig 0.1051000 0.5242413 -6.376140e-01  0.678
## Ctrl:Pen 0.4952667 0.8879894 -1.774451e-02  0.491
## Ctrl:Pod 1.0000500 1.4165075  7.627263e-04  0.494
## Ctrl:Pre 0.1351000 0.5655203 -5.899096e-01  0.648
## Ctrl:Xyl 0.3449500 0.7608720 -1.439114e-01  0.525
## Nig:Pen  0.6003667 0.9964252 -2.660414e-02  0.504
## Nig:Pod  0.8949500 1.3304591  1.686732e-02  0.506
## Nig:Pre  0.0300000 0.5371340 -1.199612e+00  0.932
## Nig:Xyl  0.4500500 0.9089682 -1.046968e-01  0.531
## Pen:Pod  1.4953167 1.9276026 -5.681110e-03  0.511
## Pen:Pre  0.6303667 1.0685515 -1.365553e-02  0.518
## Pen:Xyl  0.1503167 0.5969929 -5.105108e-01  0.622
## Pod:Pre  0.8649500 1.3545564  4.009262e-03  0.505
## Pod:Xyl  1.3450000 1.8303491 -4.279087e-02  0.528
## Pre:Xyl  0.4800500 0.9642244 -8.350287e-02  0.523
highpw2 <- pairwise(highLM, groups = high$Age)
summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                 d UCL (95%)          Z Pr > d
## Old:Young 0.82123  1.025669 0.08700829   0.45
lowpw <- pairwise(lowLM, groups = low$Fungus)
summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)             Z Pr > d
## Asp:Cer  0.92008333 1.5720712  0.0678586475  0.474
## Asp:Cok  0.47886667 1.2146186 -0.2178031399  0.521
## Asp:Ctrl 0.01381667 0.7543234 -1.2733739955  0.967
## Asp:Nig  0.52823333 1.2430587 -0.1043910973  0.489
## Asp:Pen  0.40398333 1.0515362 -0.1464333981  0.491
## Asp:Pod  0.10601667 0.8029328 -0.9219082734  0.804
## Asp:Pre  1.05458333 1.7086850  0.0187078538  0.502
## Asp:Xyl  0.26583333 1.2811022 -0.5864877562  0.671
## Cer:Cok  1.39895000 2.1300418  0.0096921857  0.496
## Cer:Ctrl 0.90626667 1.5517110  0.0479615991  0.478
## Cer:Nig  0.39185000 1.1441704 -0.2766390792  0.525
## Cer:Pen  0.51610000 1.1546081 -0.0884521570  0.501
## Cer:Pod  0.81406667 1.4771202  0.0079406657  0.486
## Cer:Pre  0.13450000 0.8577604 -0.8048058541  0.759
## Cer:Xyl  0.65425000 1.6480842 -0.1674366668  0.509
## Cok:Ctrl 0.49268333 1.2162097 -0.1920536284  0.524
## Cok:Nig  1.00710000 1.7998018 -0.0286045174  0.521
## Cok:Pen  0.88285000 1.5932777 -0.0411620009  0.518
## Cok:Pod  0.58488333 1.2904957 -0.1232107053  0.520
## Cok:Pre  1.53345000 2.2981649 -0.0393285501  0.511
## Cok:Xyl  0.74470000 1.7063965 -0.1148949707  0.500
## Ctrl:Nig 0.51441667 1.2596794 -0.1404352867  0.510
## Ctrl:Pen 0.39016667 1.0154965 -0.1829154233  0.511
## Ctrl:Pod 0.09220000 0.8067514 -0.9225830360  0.815
## Ctrl:Pre 1.04076667 1.6999822 -0.0006409169  0.495
## Ctrl:Xyl 0.25201667 1.2827291 -0.6371056985  0.678
## Nig:Pen  0.12425000 0.9550303 -0.8730704753  0.793
## Nig:Pod  0.42221667 1.1696425 -0.2618664491  0.546
## Nig:Pre  0.52635000 1.3379634 -0.1756051775  0.524
## Nig:Xyl  0.26240000 1.3637741 -0.6710819396  0.691
## Pen:Pod  0.29796667 0.9564494 -0.3786666724  0.566
## Pen:Pre  0.65060000 1.3175833 -0.0759634282  0.513
## Pen:Xyl  0.13815000 1.2159924 -0.8514362884  0.803
## Pod:Pre  0.94856667 1.6427931 -0.0482247913  0.520
## Pod:Xyl  0.15981667 1.2255936 -0.8653035282  0.792
## Pre:Xyl  0.78875000 1.7594061 -0.1613061192  0.511
lowpw2 <- pairwise(lowLM, groups = low$Age)
summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)          Z Pr > d
## Old:Young 0.7019609  1.012106 0.06918075  0.465
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, 
    high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, 
    low$Fungus))

## chl b linear models and coefficient tests
highLM <- lm.rrpp(Chl.b ~ Block * Fungus * Age, data = high, 
    SS.type = "III", print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(highLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 87.50118    6.465898 0.9311898 3.492315
##                      Z (from F)     Pr(>F)
## Block * Fungus * Age   2.069305 0.02857143
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##               Trace Proportion Rank
## Fitted    2.2436201  0.9311898    1
## Residuals 0.1657923  0.0688103    1
## Total     2.4094123  1.0000000    1
## 
## Eigenvalues
## 
##                 PC1
## Fitted    2.2436201
## Residuals 0.1657923
## Total     2.4094123
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               0.9718000 2.8583704 -1.03660693  0.852
## Block                     0.3138000 0.6898212  0.18482158  0.372
## FungusCer                 1.0423000 1.7033771  0.51606112  0.292
## FungusCok                 2.8819000 3.5618688  0.56062421  0.284
## FungusCtrl                1.0827667 2.5505618 -0.05217995  0.470
## FungusNig                 2.5081667 2.5226141  1.82220700  0.053
## FungusPen                 0.9413333 2.3718940 -0.07297045  0.467
## FungusPod                 1.8891000 2.6749685  0.92632436  0.198
## FungusPre                 1.0948000 1.9614740  0.48818761  0.285
## FungusXyl                 1.1520000 2.5970673  0.14132966  0.359
## AgeYoung                  3.0766333 3.2160129  1.51609523  0.067
## Block:FungusCtrl          0.3293500 1.0469873 -0.31667387  0.535
## Block:FungusNig           1.0558000 1.0394326  1.93972982  0.046
## Block:FungusPen           0.3389500 1.0211341 -0.26347545  0.520
## Block:FungusPod           0.8227000 1.4470045  0.47080656  0.286
## Block:FungusPre           0.0753000 1.2622658 -1.26974634  0.936
## Block:FungusXyl           0.4171000 1.6212900 -0.49908304  0.613
## Block:AgeYoung            0.9157500 1.0320887  1.68338472  0.070
## FungusCer:AgeYoung        0.4449167 2.6884392 -1.00424383  0.816
## FungusCok:AgeYoung        0.3173833 1.9478067 -0.79718639  0.760
## FungusCtrl:AgeYoung       1.2420667 3.7434431 -0.45354092  0.615
## FungusNig:AgeYoung        1.8611000 3.8347514  0.13132629  0.412
## FungusPen:AgeYoung        0.4409667 2.6500513 -0.83491769  0.767
## FungusPod:AgeYoung        0.6755667 6.3330293 -1.59386532  0.944
## FungusPre:AgeYoung        1.8436833 2.8767622  0.79924471  0.211
## FungusXyl:AgeYoung        2.3386333 3.5882666  0.78755615  0.197
## Block:FungusCtrl:AgeYoung 0.1244500 1.2142553 -1.07014865  0.862
## Block:FungusNig:AgeYoung  1.6630000 1.3029613  2.83789016  0.018
## Block:FungusPen:AgeYoung  0.2330000 1.2264443 -0.75102567  0.732
## Block:FungusPod:AgeYoung  1.5442500 2.0239529  1.11457912  0.146
## Block:FungusPre:AgeYoung  1.0738000 1.2646536  1.42148600  0.104
## Block:FungusXyl:AgeYoung  1.4224500 2.1002427  0.86848907  0.189
lowLM <- lm.rrpp(Chl.b ~ Block * Fungus * Age, data = low, SS.type = "III", 
    print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(lowLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 183.9456    24.99044 0.8803919 2.676596
##                      Z (from F)     Pr(>F)
## Block * Fungus * Age   2.057026 0.02457143
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    4.087680  0.8803919    1
## Residuals 0.555343  0.1196081    1
## Total     4.643023  0.9999999    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    4.087680
## Residuals 0.555343
## Total     4.643023
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                                d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)                9.7034333  8.969915  2.28549354  0.020
## Block                      2.7120500  2.096513  2.93023576  0.007
## FungusCer                  3.7832333  4.811233  1.28983593  0.116
## FungusCok                  4.1255333  5.680391  0.99550908  0.175
## FungusCtrl                 3.7724667  5.120217  1.01606240  0.157
## FungusNig                  1.3687333  5.163887 -0.41968895  0.574
## FungusPen                  4.7273333  4.621536  1.99972450  0.044
## FungusPod                  3.1066000  6.108060  0.20132282  0.384
## FungusPre                  5.9124000  4.367254  2.98749742  0.011
## FungusXyl                  0.6566833  3.774410 -0.80998918  0.744
## AgeYoung                   6.7049333  4.886029  3.05596826  0.011
## Block:FungusCer            1.3418000  2.254783  0.60001739  0.254
## Block:FungusCok            1.2609500  3.573562 -0.22171967  0.519
## Block:FungusCtrl           1.2197000  3.018750 -0.18580118  0.514
## Block:FungusNig            0.6864500  2.404786 -0.35675722  0.540
## Block:FungusPen            1.3535000  3.028536 -0.03837009  0.465
## Block:FungusPod            0.7918000  3.711903 -1.13033119  0.859
## Block:FungusPre            1.6565000  3.030321  0.31874466  0.363
## Block:AgeYoung             4.5699500  2.540569  4.57087308  0.001
## FungusCer:AgeYoung         5.2040333  7.518396  0.96732553  0.174
## FungusCok:AgeYoung         7.7240333  8.049198  1.75260860  0.060
## FungusCtrl:AgeYoung        7.8890333  7.342928  2.13789398  0.034
## FungusNig:AgeYoung         3.7873833  6.916607  0.47405782  0.273
## FungusPen:AgeYoung         9.7007000  6.193270  3.58918820  0.003
## FungusPod:AgeYoung         7.1257000  9.183868  1.10856440  0.147
## FungusPre:AgeYoung        10.7553667  6.425508  4.09847422  0.001
## FungusXyl:AgeYoung         1.5143833  5.829198 -0.59593503  0.676
## Block:FungusCer:AgeYoung   3.5053500  2.980275  2.44294656  0.024
## Block:FungusCok:AgeYoung   4.1488500  4.603948  1.55253934  0.086
## Block:FungusCtrl:AgeYoung  4.8520000  3.052348  3.86774216  0.002
## Block:FungusNig:AgeYoung   2.2579000  3.200773  1.05591140  0.151
## Block:FungusPen:AgeYoung   5.1965000  2.924345  4.47088715  0.001
## Block:FungusPod:AgeYoung   5.3413500  2.851511  4.56365093  0.001
## Block:FungusPre:AgeYoung   5.7951500  2.868602  5.09678018  0.001
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(highANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)  
## Block             1  0.197 0.19694 0.002096 0.2437           0.585  
## Fungus            8  5.524 0.69044 0.058781 2.7711  0.87223  0.188  
## Age               1  2.028 2.02836 0.021586 5.0392  1.24671  0.049 *
## Block:Fungus      6  1.495 0.24916 0.015909 0.3083 -1.29905  0.917  
## Block:Age         1  0.839 0.83860 0.008924 2.0834           0.140  
## Fungus:Age        8  2.190 0.27375 0.023306 0.6801 -0.82424  0.801  
## Block:Fungus:Age  6  2.415 0.40251 0.025701 0.4980 -0.78151  0.787  
## Residuals         8  6.466 0.80824 0.068810                         
## Total            39 93.967                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(lowANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS      MS      Rsq      F        Z Pr(>F)  
## Block             1  14.710 14.7104 0.070406 7.0637           0.040 *
## Fungus            8  11.605  1.4506 0.055542 2.7036  1.62255  0.064 .
## Age               1   9.633  9.6335 0.046107 2.5619  1.11040  0.070 .
## Block:Fungus      7   3.756  0.5365 0.017976 0.2576 -1.63483  0.942  
## Block:Age         1  20.884 20.8844 0.099956 5.5539           0.017 *
## Fungus:Age        8  19.625  2.4531 0.093927 0.6524 -0.73125  0.784  
## Block:Fungus:Age  7  26.322  3.7604 0.125983 1.8057  0.92115  0.167  
## Residuals        12  24.990  2.0825 0.119608                         
## Total            45 208.936                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Chl.b ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus)
summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                   d UCL (95%)             Z Pr > d
## Asp:Cer  1.40883333 1.9945336  0.0637606595  0.492
## Asp:Cok  2.86728333 3.4661925 -0.0047963567  0.500
## Asp:Ctrl 1.16955000 1.6112341  0.0083118362  0.501
## Asp:Nig  1.12901667 1.5695399 -0.0202340908  0.514
## Asp:Pen  0.27595000 0.7537367 -0.1784436293  0.502
## Asp:Pod  2.22305833 2.7169381 -0.0030759276  0.501
## Asp:Pre  1.09615833 1.5899385  0.0004934936  0.493
## Asp:Xyl  0.49590833 0.9758634  0.0048394708  0.481
## Cer:Cok  1.45845000 2.2753518 -0.0573008139  0.516
## Cer:Ctrl 0.23928333 0.8477858 -0.4895285835  0.614
## Cer:Nig  0.27981667 0.8912138 -0.3951570849  0.585
## Cer:Pen  1.13288333 1.7543083  0.0489657952  0.505
## Cer:Pod  0.81422500 1.5207386 -0.0788821420  0.526
## Cer:Pre  0.31267500 0.9615748 -0.3437307668  0.569
## Cer:Xyl  0.91292500 1.5369945  0.0151171726  0.503
## Cok:Ctrl 1.69773333 2.2978103 -0.0105851449  0.514
## Cok:Nig  1.73826667 2.3818621  0.0092136674  0.506
## Cok:Pen  2.59133333 3.2151287 -0.0190620434  0.517
## Cok:Pod  0.64422500 1.3009886 -0.0612888345  0.505
## Cok:Pre  1.77112500 2.4287079 -0.0046510510  0.510
## Cok:Xyl  2.37137500 3.0356656 -0.0435889705  0.517
## Ctrl:Nig 0.04053333 0.5294233 -1.0916038475  0.888
## Ctrl:Pen 0.89360000 1.3612861 -0.0121300105  0.493
## Ctrl:Pod 1.05350833 1.5421654 -0.0106100482  0.518
## Ctrl:Pre 0.07339167 0.6205608 -0.9594614150  0.814
## Ctrl:Xyl 0.67364167 1.1572582 -0.0523155704  0.525
## Nig:Pen  0.85306667 1.3181976 -0.0397347478  0.519
## Nig:Pod  1.09404167 1.5924091  0.0141541023  0.514
## Nig:Pre  0.03285833 0.6157437 -1.2293129879  0.932
## Nig:Xyl  0.63310833 1.1638414 -0.0819411492  0.532
## Pen:Pod  1.94710833 2.4647373 -0.0216389701  0.502
## Pen:Pre  0.82020833 1.3278977 -0.0181917671  0.512
## Pen:Xyl  0.21995833 0.7232532 -0.3870178122  0.572
## Pod:Pre  1.12690000 1.6920741 -0.0031561014  0.491
## Pod:Xyl  1.72715000 2.2883888 -0.0491816153  0.539
## Pre:Xyl  0.60025000 1.1499453 -0.0721971246  0.521
highpw2 <- pairwise(highLM, groups = high$Age)
summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 2.190885  2.435993 0.08979591  0.452
lowpw <- pairwise(lowLM, groups = low$Fungus)
summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)             Z Pr > d
## Asp:Cer  2.0029667  2.942593  5.551760e-02  0.469
## Asp:Cok  1.2701917  2.369217  3.901236e-03  0.490
## Asp:Ctrl 2.2405500  3.266076  1.441241e-02  0.502
## Asp:Nig  0.3600417  1.512806 -5.837500e-01  0.646
## Asp:Pen  2.3664833  3.342638  2.283370e-02  0.486
## Asp:Pod  3.3015000  4.270812  6.647641e-02  0.481
## Asp:Pre  3.0168667  3.990030  1.870943e-02  0.487
## Asp:Xyl  0.5275833  2.076821 -4.892711e-01  0.623
## Cer:Cok  0.7327750  1.861699 -1.587278e-01  0.504
## Cer:Ctrl 0.2375833  1.328923 -7.667723e-01  0.742
## Cer:Nig  1.6429250  2.771172  1.270720e-02  0.504
## Cer:Pen  0.3635167  1.370296 -4.996732e-01  0.622
## Cer:Pod  1.2985333  2.343280 -3.979415e-03  0.491
## Cer:Pre  1.0139000  2.040683 -8.423441e-02  0.524
## Cer:Xyl  2.5305500  4.010692 -5.448366e-05  0.476
## Cok:Ctrl 0.9703583  2.064697 -9.973555e-02  0.514
## Cok:Nig  0.9101500  2.057411 -1.106110e-01  0.505
## Cok:Pen  1.0962917  2.213880 -5.475120e-02  0.509
## Cok:Pod  2.0313083  3.172132  2.763028e-02  0.477
## Cok:Pre  1.7466750  2.919395 -1.541431e-02  0.503
## Cok:Xyl  1.7977750  3.477338 -2.837168e-02  0.486
## Ctrl:Nig 1.8805083  3.010984 -1.697763e-02  0.506
## Ctrl:Pen 0.1259333  1.232834 -1.013516e+00  0.842
## Ctrl:Pod 1.0609500  1.987635  2.012947e-02  0.481
## Ctrl:Pre 0.7763167  1.758984 -1.125456e-01  0.516
## Ctrl:Xyl 2.7681333  4.353823 -2.837150e-02  0.500
## Nig:Pen  2.0064417  3.131585 -1.016671e-02  0.503
## Nig:Pod  2.9414583  4.058314  2.983836e-02  0.487
## Nig:Pre  2.6568250  3.885838 -1.353280e-02  0.491
## Nig:Xyl  0.8876250  2.485887 -2.303612e-01  0.513
## Pen:Pod  0.9350167  1.883259  3.707117e-03  0.473
## Pen:Pre  0.6503833  1.658783 -1.596798e-01  0.512
## Pen:Xyl  2.8940667  4.414800 -2.433315e-02  0.498
## Pod:Pre  0.2846333  1.233337 -5.811612e-01  0.652
## Pod:Xyl  3.8290833  5.362483  6.367113e-03  0.475
## Pre:Xyl  3.5444500  5.145378 -2.662861e-02  0.503
lowpw2 <- pairwise(lowLM, groups = low$Age)
summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)           Z Pr > d
## Old:Young 1.035035  1.547157 0.008272272  0.502
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, 
    high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, 
    low$Fungus))

## Total linear models and coefficient tests
highLM <- lm.rrpp(Total ~ Block * Fungus * Age, data = high, 
    SS.type = "III", print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 32
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(highLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 31           8 221.9666    22.53375 0.9078376 2.542041
##                      Z (from F)     Pr(>F)
## Block * Fungus * Age    1.50047 0.06657143
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    5.691452  0.9078375    1
## Residuals 0.577788  0.0921624    1
## Total     6.269241  1.0000000    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    5.691452
## Residuals 0.577788
## Total     6.269241
coef(highLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 40
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)         Zd Pr(>d)
## (Intercept)               2.4605000  5.920830 -0.9732179  0.850
## Block                     0.3327000  1.325547 -0.5496670  0.651
## FungusCer                 1.9381000  3.191372  0.4908956  0.298
## FungusCok                 6.0044000  7.281553  0.5379335  0.279
## FungusCtrl                1.5441000  4.482527 -0.2560890  0.531
## FungusNig                 5.0907000  5.022310  1.8473197  0.046
## FungusPen                 2.1842000  4.764053  0.1040508  0.404
## FungusPod                 3.0680000  4.986713  0.6383150  0.250
## FungusPre                 2.3511500  3.714938  0.7178551  0.238
## FungusXyl                 2.1986000  4.881486  0.1887340  0.340
## AgeYoung                  4.4501333  4.853749  1.5389731  0.076
## Block:FungusCtrl          0.4002000  1.850631 -0.6059016  0.657
## Block:FungusNig           2.0625000  1.979667  2.0092496  0.039
## Block:FungusPen           0.6948000  1.937021 -0.1501771  0.486
## Block:FungusPod           1.0500000  2.722623 -0.1071264  0.473
## Block:FungusPre           0.1543500  2.258982 -1.2056489  0.912
## Block:FungusXyl           0.7074000  2.973520 -0.5584964  0.632
## Block:AgeYoung            1.3986000  1.766544  1.3331748  0.114
## FungusCer:AgeYoung        0.5794667  4.609162 -1.0592039  0.835
## FungusCok:AgeYoung        1.5839333  3.218044  0.2225087  0.368
## FungusCtrl:AgeYoung       2.3970000  6.852218 -0.3590399  0.582
## FungusNig:AgeYoung        4.0526667  6.681245  0.5568047  0.285
## FungusPen:AgeYoung        1.3145333  4.967385 -0.5153642  0.617
## FungusPod:AgeYoung        1.4089667 11.155901 -1.3660827  0.902
## FungusPre:AgeYoung        3.6231833  5.155174  0.9859370  0.158
## FungusXyl:AgeYoung        4.2304333  6.711787  0.7340295  0.207
## Block:FungusCtrl:AgeYoung 0.1023000  2.285465 -1.2404952  0.943
## Block:FungusNig:AgeYoung  3.1697000  2.424762  2.9364990  0.014
## Block:FungusPen:AgeYoung  0.5183000  2.332142 -0.6313884  0.674
## Block:FungusPod:AgeYoung  2.2897000  3.747401  0.6164059  0.238
## Block:FungusPre:AgeYoung  1.8753500  2.349132  1.2477925  0.126
## Block:FungusXyl:AgeYoung  2.4271000  3.890555  0.6786493  0.227
lowLM <- lm.rrpp(Total ~ Block * Fungus * Age, data = low, SS.type = "III", 
    print.progress = F)
## 
## Warning: Because variables in the linear model are redundant,
## the linear model design has been truncated (via QR decomposition).
## Original X columns: 36
## Final X columns (rank): 34
## Check coefficients or degrees of freedom in ANOVA to see changes.
summary(lowLM)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1  
## Data space dimensions: 1  
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Full Model Analysis of Variance
## 
##                      Df Residual Df       SS Residual SS       Rsq        F
## Block * Fungus * Age 33          12 314.3371    57.59527 0.8451458 1.984614
##                      Z (from F)     Pr(>F)
## Block * Fungus * Age   1.464465 0.08057143
## 
## 
## Redundancy Analysis (PCA on fitted values and residuals)
## 
##              Trace Proportion Rank
## Fitted    6.985269  0.8451459    1
## Residuals 1.279895  0.1548542    1
## Total     8.265164  1.0000000    1
## 
## Eigenvalues
## 
##                PC1
## Fitted    6.985269
## Residuals 1.279895
## Total     8.265164
coef(lowLM, test = T)
## 
## Linear Model fit with lm.rrpp
## 
## Number of observations: 46
## Number of dependent variables: 1
## Data space dimensions: 1
## Sums of Squares and Cross-products: Type III
## Number of permutations: 1000
## 
## Statistics (distances) of coefficients with 95 percent confidence intervals,
## effect sizes, and probabilities of exceeding observed values based on
## 1000 random permutations using RRPP 
## 
##                               d.obs UCL (95%)          Zd Pr(>d)
## (Intercept)               14.046500 14.147632  1.59282901  0.058
## Block                      3.426250  3.290589  1.79950611  0.041
## FungusCer                  6.577567  7.392581  1.47825353  0.087
## FungusCok                  1.492200  7.273627 -0.61949886  0.663
## FungusCtrl                 1.270733  6.319047 -0.70267111  0.714
## FungusNig                  2.480000  5.762513  0.12206610  0.368
## FungusPen                  3.122967  6.178017  0.32631733  0.326
## FungusPod                  4.613567  6.470651  1.02121148  0.170
## FungusPre                  5.691400  5.707320  1.95829327  0.052
## FungusXyl                  2.848150  4.217050  0.85427183  0.179
## AgeYoung                   5.608600  5.811837  1.81566252  0.059
## Block:FungusCer            2.231300  2.607066  1.40979606  0.097
## Block:FungusCok            0.322250  4.824937 -1.15350193  0.902
## Block:FungusCtrl           0.010650  3.765990 -1.46488265  0.999
## Block:FungusNig            0.964250  2.661146 -0.14185727  0.477
## Block:FungusPen            0.351150  4.056759 -1.42661488  0.939
## Block:FungusPod            0.971500  2.845590 -0.16662065  0.485
## Block:FungusPre            0.982450  3.986420 -0.83398856  0.769
## Block:AgeYoung             4.185050  3.101306  3.02482067  0.011
## FungusCer:AgeYoung         6.105833  8.416641  1.03123275  0.172
## FungusCok:AgeYoung         4.642800 10.040343  0.21199777  0.354
## FungusCtrl:AgeYoung        3.677733  9.053234  0.01209651  0.435
## FungusNig:AgeYoung         4.948250  7.966459  0.66847968  0.234
## FungusPen:AgeYoung         8.437000  7.970256  2.17918532  0.036
## FungusPod:AgeYoung         4.244600  8.901833  0.27889328  0.329
## FungusPre:AgeYoung        10.636200  7.897802  3.14051586  0.009
## FungusXyl:AgeYoung         3.552350  4.956430  0.95239210  0.186
## Block:FungusCer:AgeYoung   3.861000  3.629037  2.13877657  0.037
## Block:FungusCok:AgeYoung   2.405350  5.683113  0.05617713  0.407
## Block:FungusCtrl:AgeYoung  2.843800  3.739075  1.18005737  0.137
## Block:FungusNig:AgeYoung   2.810900  3.597535  1.23553528  0.125
## Block:FungusPen:AgeYoung   4.568300  3.599418  2.77233699  0.019
## Block:FungusPod:AgeYoung   2.859250  3.692270  1.21155396  0.133
## Block:FungusPre:AgeYoung   5.663050  3.460660  3.91974843  0.001
# ratio anovas
highANOVA <- anova(highLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(highANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df      SS     MS      Rsq      F        Z Pr(>F)  
## Block             1   0.221 0.2214 0.000905 0.0786           0.693  
## Fungus            8  24.327 3.0408 0.099495 3.3018  0.92054  0.182  
## Age               1   4.244 4.2436 0.017356 3.1404           0.087 .
## Block:Fungus      6   5.526 0.9210 0.022600 0.3270 -1.18349  0.889  
## Block:Age         1   1.956 1.9561 0.008000 1.4475           0.200  
## Fungus:Age        8   8.799 1.0999 0.035989 0.8140 -0.56109  0.709  
## Block:Fungus:Age  6   8.108 1.3513 0.033161 0.4797 -0.82034  0.795  
## Residuals         8  22.534 2.8167 0.092162                         
## Total            39 244.500                                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Total ~ Block * Fungus * Age, SS.type = "III", data = high,  
##     print.progress = F)
lowANOVA <- anova(lowLM, effect.type = "F", error = c("Residuals", 
    "Block:Fungus", "Block:Fungus:Age", "Residuals", "Block:Fungus:Age", 
    "Block:Fungus:Age", "Residuals"))
summary(lowANOVA)
## 
## Analysis of Variance, using Residual Randomization
## Permutation procedure: Randomization of null model residuals 
## Number of permutations: 1000 
## Estimation method: Ordinary Least Squares 
## Sums of Squares and Cross-products: Type III 
## Effect sizes (Z) based on F distributions
## 
##                  Df     SS      MS      Rsq      F        Z Pr(>F)   
## Block             1  23.48 23.4784 0.063125 4.8917           0.059 . 
## Fungus            8  15.97  1.9959 0.042930 1.7917  0.82125  0.174   
## Age               1   6.74  6.7407 0.018123 2.4616  1.03071  0.108   
## Block:Fungus      7   7.80  1.1140 0.020966 0.2321 -1.57930  0.949   
## Block:Age         1  17.51 17.5146 0.047091 6.3962           0.007 **
## Fungus:Age        8  15.32  1.9152 0.041195 0.6994 -0.75229  0.789   
## Block:Fungus:Age  7  19.17  2.7383 0.051536 0.5705 -0.64515  0.749   
## Residuals        12  57.60  4.7996 0.154854                          
## Total            45 371.93                                           
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Call: lm.rrpp(f1 = Total ~ Block * Fungus * Age, SS.type = "III", data = low,  
##     print.progress = F)
# pairwise
highpw <- pairwise(highLM, groups = high$Fungus)
summary(highpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                    d UCL (95%)             Z Pr > d
## Asp:Cer  2.594433333 3.6721392  0.0623334604  0.488
## Asp:Cok  5.579033333 6.6767439 -0.0072307614  0.511
## Asp:Ctrl 2.044500000 2.8709959  0.0044865681  0.503
## Asp:Nig  2.109066667 2.9224115 -0.0199041407  0.511
## Asp:Pen  0.655633333 1.5546638 -0.0795169852  0.495
## Asp:Pod  4.098058333 4.9833487 -0.0013203580  0.505
## Asp:Pre  2.106208333 3.0177705 -0.0016048283  0.507
## Asp:Xyl  1.025908333 1.9013216  0.0227288228  0.481
## Cer:Cok  2.984600000 4.5300312 -0.0575604669  0.523
## Cer:Ctrl 0.549933333 1.6776245 -0.3630493074  0.572
## Cer:Nig  0.485366667 1.6374291 -0.4361145401  0.596
## Cer:Pen  1.938800000 3.0863939  0.0497056859  0.502
## Cer:Pod  1.503625000 2.8260292 -0.0773612229  0.523
## Cer:Pre  0.488225000 1.6991273 -0.4574227423  0.612
## Cer:Xyl  1.568525000 2.7271735  0.0050097166  0.494
## Cok:Ctrl 3.534533333 4.6121712 -0.0102291978  0.508
## Cok:Nig  3.469966667 4.6631701  0.0067391694  0.512
## Cok:Pen  4.923400000 6.0655360 -0.0170282585  0.511
## Cok:Pod  1.480975000 2.7002623 -0.0335369928  0.505
## Cok:Pre  3.472825000 4.6739885 -0.0052763132  0.508
## Cok:Xyl  4.553125000 5.7733336 -0.0449782246  0.520
## Ctrl:Nig 0.064566667 0.9993244 -1.0898908451  0.895
## Ctrl:Pen 1.388866667 2.2510710 -0.0113472493  0.494
## Ctrl:Pod 2.053558333 2.9398952 -0.0053672177  0.501
## Ctrl:Pre 0.061708333 1.0887264 -1.1653588504  0.908
## Ctrl:Xyl 1.018591667 1.9314309 -0.0715412761  0.521
## Nig:Pen  1.453433333 2.3123537 -0.0332901209  0.513
## Nig:Pod  1.988991667 2.9118283  0.0155649776  0.510
## Nig:Pre  0.002858333 1.1281646 -1.3947397396  0.996
## Nig:Xyl  1.083158333 2.0667876 -0.0894864502  0.534
## Pen:Pod  3.442425000 4.3985404 -0.0143118744  0.504
## Pen:Pre  1.450575000 2.4117002 -0.0155429096  0.517
## Pen:Xyl  0.370275000 1.3041777 -0.4362776834  0.602
## Pod:Pre  1.991850000 3.0452676  0.0002494841  0.494
## Pod:Xyl  3.072150000 4.1144333 -0.0463846136  0.532
## Pre:Xyl  1.080300000 2.1212680 -0.0767809966  0.519
highpw2 <- pairwise(highLM, groups = high$Age)
summary(highpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 3.012115  3.462799 0.08881142  0.451
lowpw <- pairwise(lowLM, groups = low$Fungus)
summary(lowpw, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Asp Cer Cok Ctrl Nig Pen Pod Pre Xyl 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)            Z Pr > d
## Asp:Cer  2.9230500  4.105414  0.085177960  0.463
## Asp:Cok  0.7913250  2.126375 -0.172584235  0.514
## Asp:Ctrl 2.2543667  3.485428  0.020099936  0.503
## Asp:Nig  0.8882750  2.303592 -0.149355519  0.496
## Asp:Pen  2.7704667  3.991072  0.041620060  0.478
## Asp:Pod  3.4075167  4.603394  0.085877001  0.457
## Asp:Pre  4.0714500  5.285035  0.026563125  0.484
## Asp:Xyl  0.2617500  2.253667 -0.956286762  0.824
## Cer:Cok  2.1317250  3.426954  0.020790746  0.508
## Cer:Ctrl 0.6686833  1.855307 -0.223783754  0.508
## Cer:Nig  2.0347750  3.312538  0.021003452  0.499
## Cer:Pen  0.1525833  1.489768 -0.971200177  0.842
## Cer:Pod  0.4844667  1.732166 -0.461654419  0.620
## Cer:Pre  1.1484000  2.418925 -0.127671539  0.530
## Cer:Xyl  3.1848000  4.906868 -0.012847885  0.496
## Cok:Ctrl 1.4630417  2.853609 -0.077576556  0.532
## Cok:Nig  0.0969500  1.775473 -1.153234415  0.922
## Cok:Pen  1.9791417  3.252532 -0.025517105  0.524
## Cok:Pod  2.6161917  3.983672  0.019661318  0.490
## Cok:Pre  3.2801250  4.638539 -0.031645138  0.509
## Cok:Xyl  1.0530750  2.959145 -0.276003399  0.547
## Ctrl:Nig 1.3660917  2.855899 -0.072110461  0.510
## Ctrl:Pen 0.5161000  1.806311 -0.402903536  0.581
## Ctrl:Pod 1.1531500  2.306431  0.016278891  0.474
## Ctrl:Pre 1.8170833  3.055947 -0.001732709  0.487
## Ctrl:Xyl 2.5161167  4.380340 -0.065556435  0.516
## Nig:Pen  1.8821917  3.211277 -0.022984604  0.506
## Nig:Pod  2.5192417  3.864774  0.030450520  0.499
## Nig:Pre  3.1831750  4.548475 -0.023441309  0.500
## Nig:Xyl  1.1500250  3.067854 -0.260194969  0.550
## Pen:Pod  0.6370500  1.804311 -0.219321591  0.507
## Pen:Pre  1.3009833  2.571577 -0.040024804  0.496
## Pen:Xyl  3.0322167  4.801769 -0.043255224  0.523
## Pod:Pre  0.6639333  1.905160 -0.309884608  0.551
## Pod:Xyl  3.6692667  5.457112 -0.009533509  0.504
## Pre:Xyl  4.3332000  6.145788 -0.050869515  0.543
lowpw2 <- pairwise(lowLM, groups = low$Age)
summary(lowpw2, confidence = 0.95, stat.table = T)
## 
## Pairwise comparisons
## 
## Groups: Old Young 
## 
## RRPP: 1000 permutations
## 
## LS means:
## Vectors hidden (use show.vectors = TRUE to view)
## 
## Pairwise distances between means, plus statistics
##                  d UCL (95%)          Z Pr > d
## Old:Young 1.736996  2.317068 0.04409585  0.489
# residuals vs fitted values (homoscedasticity check)
hdiagnostics <- plot(highLM, type = "diagnostics")

# pca plot
hpcplot <- plot(highLM, type = "PC", pch = 19, col = interaction(high$Water, 
    high$Fungus))

# residuals vs fitted values (homoscedasticity check)
ldiagnostics <- plot(lowLM, type = "diagnostics")

# pca plot
lpcplot <- plot(lowLM, type = "PC", pch = 19, col = interaction(low$Water, 
    low$Fungus))

  1. Indicator Analysis
library(labdsv)
## High water
indicator_high <- indval(high[, 5:8], clustering = high$Fungus, 
    numitr = 999, type = "long")

write.csv(cbind(indicator_high$relfrq, indicator_high$relabu, 
    indicator_high$indval, data.frame(indicator_high$maxcls), 
    data.frame(indicator_high$indcls), data.frame(indicator_high$pval)), 
    "~/Box/Summer 2018 TX Endo Field Samples and Analysis/Statistics/Old + Young Chlorophyll/Indicator_Analys_High_Fungus.csv")

## Low water
indicator_low <- indval(low[, 5:8], clustering = low$Fungus, 
    numitr = 999, type = "long")

write.csv(cbind(indicator_low$relfrq, indicator_low$relabu, indicator_low$indval, 
    data.frame(indicator_low$maxcls), data.frame(indicator_low$indcls), 
    data.frame(indicator_low$pval)), "~/Box/Summer 2018 TX Endo Field Samples and Analysis/Statistics/Old + Young Chlorophyll/Indicator_Analys_Low_Fungus.csv")